import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
//列表数据
export const columns: BasicColumn[] = [
   {
    title: '学/工号',
    align:"center",
    dataIndex: 'code'
   },
   {
    title: '姓名',
    align:"center",
    dataIndex: 'name'
   },
   {
    title: '所属部门',
    align:"center",
    dataIndex: 'departmentId_dictText'
   },
   {
    title: '变更类型',
    align:"center",
    dataIndex: 'changeType',
    customRender: ({ record }) => {
      return record.changeType ? (record.changeType == 'n' ? '新增' :record.changeType == 'u'? '修改':'删除') : '';
    },
    
   },
   {
    title: '旧规则',
    align:"center",
    dataIndex: 'oruleName'
   },
   {
    title: '新规则',
    align:"center",
    dataIndex: 'nruleName'
   },
   {
    title: '通道名称',
    align:"center",
    dataIndex: 'channelName'
   },
  //  {
  //   title: '旧设备',
  //   align:"center",
  //   dataIndex: 'odev'
  //  },
  //  {
  //   title: '新设备',
  //   align:"center",
  //   dataIndex: 'ndev'
  //  },
   {
    title: '新授权类型',
    align:"center",
    dataIndex: 'nauthType',
    customRender: ({ text }) => {
      return render.renderDict(text, 'auth_type');
    },
   },
   {
    title: '旧授权类型',
    align:"center",
    dataIndex: 'oauthType',
    customRender: ({ text }) => {
      console.log("==="+text);
      return render.renderDict(text, 'auth_type');
    },
   },
   
   {
    title: '旧授权开始时间',
    align:"center",
    dataIndex: 'oStartDate',
    customRender:({text}) =>{
      return !text?"":(text.length>10?text.substr(0,10):text)
    },
   },
   {
    title: '新授权开始时间',
    align:"center",
    dataIndex: 'nStartDate',
    customRender:({text}) =>{
      return !text?"":(text.length>10?text.substr(0,10):text)
    },
   },
   {
    title: '旧授权结束时间',
    align:"center",
    dataIndex: 'oEndDate',
    customRender:({text}) =>{
      return !text?"":(text.length>10?text.substr(0,10):text)
    },
   },
   {
    title: '新授权结束时间',
    align:"center",
    dataIndex: 'nEndDate',
    customRender:({text}) =>{
      return !text?"":(text.length>10?text.substr(0,10):text)
    },
   },
];
//查询数据
export const searchFormSchema: FormSchema[] = [
  {
       label: "学/工号",
       field: 'code',
       component: 'Input',
       //colProps: {span: 6},
   },
   {
       label: "姓名",
       field: 'name',
       component: 'Input',
       //colProps: {span: 6},
   },
  {
    label: '所在部门',
    field: 'departmentId',
    component: 'JSelectDept',
    componentProps:{
      multiple:false,
      checkable:false,
    }
  },
  { 
    label:'新授权类型',
    field: 'nAuthType',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode:"auth_type"
    }
  },
  { 
    label:'旧授权类型',
    field: 'oAuthType',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode:"auth_type"
    }
  },
  {
    label: "授权时间",
    field: "createTime",
    component: 'RangePicker',
    componentProps: {
        valueType: 'Date',
    },
  },
];


// 高级查询数据
export const superQuerySchema = {
  personId: {title: '人员id',order: 0,view: 'text', type: 'string',},
  changeType: {title: '变更类型',order: 1,view: 'text', type: 'string',},
  oRuleId: {title: '旧规则id',order: 2,view: 'number', type: 'number',},
  nRuleId: {title: '新规则id',order: 3,view: 'number', type: 'number',},
  oDev: {title: '旧设备',order: 4,view: 'text', type: 'string',},
  nDev: {title: '新设备',order: 5,view: 'text', type: 'string',},
  oAuthType: {title: '旧授权类型',order: 6,view: 'text', type: 'string',},
  nAuthType: {title: '新授权类型',order: 7,view: 'text', type: 'string',},
  oStartDate: {title: '旧授权开始时间',order: 8,view: 'date', type: 'string',},
  nStartDate: {title: '新授权开始时间',order: 9,view: 'date', type: 'string',},
  oEndDate: {title: '旧授权结束时间',order: 10,view: 'date', type: 'string',},
  nEndDate: {title: '新授权结束时间',order: 11,view: 'date', type: 'string',},
};

/**
* 流程表单调用这个方法获取formSchema
* @param param
*/

